﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Perst;

namespace skiordiecore
{
    public class Participant : Persistent
    {
        public int id;
        //public String name { get; set; }

        public String firstName { get; set; }
        public String lastName { get; set; }
        //public int height { get; set; }
        public DateTime birthDate { get; set; }

        public Participant (String firstName, String lastName, DateTime birthDate)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.birthDate = birthDate;

        }

        private readonly IList<Championship> _championships = new List<Championship>();

        public IEnumerable<Championship> Championships
        {
            get { return _championships; }
        }
        /// <summary>
        /// Internal method to add the reverse relation to the Championship object.
        /// This relation should be mantained from the side of Championship object.
        /// </summary>
        /// <param name="championship"></param>
        internal void AddChampionship(Championship championship)
        {
            if (!_championships.Contains(championship))
                _championships.Add(championship);

        }
    }


}
